package com.tyt.travel.service.impl;

import com.tyt.travel.common.util.IOUtil;
import com.tyt.travel.service.CommonService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.io.InputStream;

/**
 * <p></p>
 * <p>
 * <PRE>
 * <BR>    修改记录
 * <BR>-----------------------------------------------
 * <BR>    修改日期         修改人          修改内容
 * </PRE>
 *
 * @author tianyun
 * @version 1.0
 * @date Created in 2021年02月10日 19:59
 * @since 1.0
 */
@Slf4j
@Service
public class CommonServiceImpl implements CommonService {

    @Autowired
    IOUtil ioUtils;

    @Override
    public String uploadPicture(MultipartFile file) {
        try (InputStream inputStream = file.getInputStream()){

            return ioUtils.uploadFile(inputStream, file.getOriginalFilename());
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
}
